public class Originator {
    private String currentName;
    private int currentNo;


    public Memento createMemento(){
        return new Memento(this);
    }

    public boolean restoreStateByMemento(Memento memento){
        currentName=memento.getNameState();
        currentNo=memento.getNoState();
        return true;
    }



    public Originator(String currentName, int currentNo) {
        this.currentName = currentName;
        this.currentNo = currentNo;
    }

    public Originator() {
    }

    public String getCurrentName() {
        return currentName;
    }

    public void setCurrentName(String currentName) {
        this.currentName = currentName;
    }

    public int getCurrentNo() {
        return currentNo;
    }

    public void setCurrentNo(int currentNo) {
        this.currentNo = currentNo;
    }

    @Override
    public String toString() {
        return "名称："+getCurrentName()+"\t记录编号："+getCurrentNo();
    }
}
